/*
 *  Cat.c
 *  pr1
 *
 *  Created by Javier Quevedo on 25/01/09.
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
 *
 */
#import "Cat.h"

Cat* initCat(){
	Cat *newCat = malloc(sizeof(Cat));
	
	newCat->files = malloc(sizeof(char)*11*40);
	newCat->files[0] = "models/cat/body.sgf";
	newCat->files[1] = "models/cat/eye_left.sgf";
	newCat->files[2] = "models/cat/eye_right.sgf";
	newCat->files[3] = "models/cat/hand_left.sgf";
	newCat->files[4] = "models/cat/hand_right.sgf";
	newCat->files[5] = "models/cat/leg_left.sgf";
	newCat->files[6] = "models/cat/leg_right.sgf";
	newCat->files[7] = "models/cat/nose.sgf";
	newCat->files[8] = "models/cat/tail.sgf";
	newCat->files[9] = "models/cat/teeth.sgf";
	newCat->files[10] ="models/cat/whiskers.sgf";
	
	newCat->state=CS_Stop;
	
	newCat->model = malloc(sizeof(Model));
	LoadModel(newCat->model, newCat->files , 11);
	
	newCat->main=initNode();
	setNodeRotation(newCat->main, 90.0, -1.0, 0.0, 0.0);
	setNodeTranslation(newCat->main, 0.0, 0.5, 0.0);
	newCat->main->modelPart= NULL;
	
	newCat->body = initNode();
	newCat->body->modelPart = newCat->model->modelParts[0];
	addChild(newCat->main, newCat->body);
	
	newCat->leftEye = initNode();
	newCat->leftEye->modelPart = newCat->model->modelParts[1];
	setNodeTranslation(newCat->leftEye, 0.0, 0.0, 0);
	addChild(newCat->body, newCat->leftEye);

	newCat->rightEye = initNode();
	newCat->rightEye->modelPart = newCat->model->modelParts[2];
	setNodeTranslation(newCat->leftEye, 0.0, 0.0, 0);
	addChild(newCat->body, newCat->rightEye);
	
	newCat->leftHand = initNode();
	newCat->leftHand->modelPart = newCat->model->modelParts[3];
	setNodeTranslation(newCat->leftHand, 0.0, 0.0, 0);
	addChild(newCat->body, newCat->leftHand);
	
	
	newCat->rightHand = initNode();
	newCat->rightHand->modelPart = newCat->model->modelParts[4];
	setNodeTranslation(newCat->leftHand, 0.0, 0.0, 0);
	addChild(newCat->body, newCat->rightHand);

	
	newCat->leftLeg = initNode();
	newCat->leftLeg->modelPart = newCat->model->modelParts[5];
	setNodeTranslation(newCat->leftLeg, 0.0, 0.0, 0);
	addChild(newCat->body, newCat->leftLeg);
	
	newCat->rightLeg = initNode();
	newCat->rightLeg->modelPart = newCat->model->modelParts[6];
	setNodeTranslation(newCat->rightLeg, 0.0, 0.0, 0);
	addChild(newCat->body, newCat->rightLeg);
	
	newCat->nose = initNode();
	newCat->nose->modelPart = newCat->model->modelParts[7];
	setNodeTranslation(newCat->nose, 0.0, 0.0, 0);
	addChild(newCat->body, newCat->nose);
	
	newCat->tail = initNode();
	newCat->tail->modelPart = newCat->model->modelParts[8];
	setNodeTranslation(newCat->tail, 0.0, 0.0, 0);
	addChild(newCat->body, newCat->tail);
	
	
	newCat->teeth = initNode();
	newCat->teeth->modelPart = newCat->model->modelParts[9];
	setNodeTranslation(newCat->teeth, 0.0, 0.0, 0);
	addChild(newCat->body, newCat->teeth);
	
	newCat->whiskers = initNode();
	newCat->whiskers->modelPart = newCat->model->modelParts[10];
	setNodeTranslation(newCat->whiskers, 0.0, 0.0, 0);
	addChild(newCat->body, newCat->whiskers);
	return newCat;


	
	
}
void releaseCat(Cat *_cat){
}
void setCatSize(Cat *_cat, GLfloat _catSize){
}